home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11077 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: news_1.cyrix.com!usenet
  2. From: Ken Toney <kent>
  3. Newsgroups: comp.lang.c++
  4. Subject: Use of templates in a large c++ project.
  5. Date: 12 Mar 1996 15:40:06 GMT
  6. Organization: Cyrix Corporation
  7. Message-ID: <4i45sm$97q@news_1.cyrix.com>
  8. NNTP-Posting-Host: dufess.eng.cyrix.com
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.4 sun4m)
  13. X-URL: news:comp.lang.c++/164562-164661
  14.  
  15. I am investigating the feasiblity and use of templates in a large c++
  16. program that has several library archives, header files for the library
  17. archives, and source some source code.
  18.  
  19. I would like to invoke some discussion on the following:
  20.  
  21. Ken replies...
  22.  
  23. I agree with...
  24. >"The last thing you want to do is include .cc files
  25. >in multiple translation units because the duplication
  26. >of code may lead to a larger than expected executable."
  27.  
  28. But it is a way avoid explicitly instantiated templates.
  29.  
  30. Actually you are expanding on the original problem that I
  31. uncovered, "it just happens to be your responsibility to
  32. instantiate the template".  This little feature becomes a
  33. management/development nightmare for large c++ 
  34. projects (multiple library
  35. archives, millions lines of code, many programmers). 
  36. First of all, making sure all the templates are
  37. explicitly instantiated "by hand" means that 
  38. someone has to maintain it and *always* keep it current 
  39. (if not, a group of programmers can not link).
  40. Second of all, link time could go up since the
  41. programmer may have to include the template library
  42. several times in the link command.
  43.  
  44.  
  45. A friend of mine how works at a company that uses
  46. templates on a large c++ project say they
  47. suffer from long link times and problems with
  48. undefined and/or multiply defined templates thus
  49. causing product release delays.
  50.  
  51. This company when they auto-instantiate, causes
  52. multiply defined symbols; When this company explicitly 
  53. instantiations, they have to include the template
  54. library archive several times in the link command.
  55.  
  56. We both came from a company that a did not
  57. use templates and had none of the above problems.
  58.  
  59. I do not think templates are feasible for a large
  60. c++ project since every template type has to
  61. be explicitly instantiated in file they are 
  62. defined and comments from friends about the
  63. link problems.
  64.  
  65.